home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / nivb / psinfo.frm < prev    next >
Text File  |  1995-05-07  |  5KB  |  175 lines

  1. VERSION 2.00
  2. Begin Form PSInfoForm 
  3.    Caption         =   "Print Server Information"
  4.    ClientHeight    =   3900
  5.    ClientLeft      =   1665
  6.    ClientTop       =   1545
  7.    ClientWidth     =   6495
  8.    Height          =   4305
  9.    Left            =   1605
  10.    LinkTopic       =   "Form2"
  11.    ScaleHeight     =   3900
  12.    ScaleWidth      =   6495
  13.    Top             =   1200
  14.    Width           =   6615
  15.    Begin ListBox ServerList 
  16.       Height          =   1005
  17.       Left            =   1680
  18.       TabIndex        =   7
  19.       Top             =   2160
  20.       Width           =   4695
  21.    End
  22.    Begin CommandButton OKButton 
  23.       Caption         =   "&OK"
  24.       Height          =   375
  25.       Left            =   2760
  26.       TabIndex        =   0
  27.       Top             =   3360
  28.       Width           =   975
  29.    End
  30.    Begin Label PSType 
  31.       Height          =   255
  32.       Left            =   2520
  33.       TabIndex        =   11
  34.       Top             =   1440
  35.       Width           =   2775
  36.    End
  37.    Begin Label PSVersion 
  38.       Height          =   255
  39.       Left            =   2520
  40.       TabIndex        =   10
  41.       Top             =   1200
  42.       Width           =   1455
  43.    End
  44.    Begin Label PSPrinters 
  45.       Height          =   255
  46.       Left            =   2520
  47.       TabIndex        =   9
  48.       Top             =   960
  49.       Width           =   1455
  50.    End
  51.    Begin Label PSStatus 
  52.       Height          =   255
  53.       Left            =   2520
  54.       TabIndex        =   8
  55.       Top             =   720
  56.       Width           =   3015
  57.    End
  58.    Begin Label Label5 
  59.       Alignment       =   1  'Right Justify
  60.       Caption         =   "Attached servers:"
  61.       Height          =   255
  62.       Left            =   720
  63.       TabIndex        =   6
  64.       Top             =   1800
  65.       Width           =   1575
  66.    End
  67.    Begin Label Label4 
  68.       Alignment       =   1  'Right Justify
  69.       Caption         =   "Server type:"
  70.       Height          =   255
  71.       Left            =   960
  72.       TabIndex        =   5
  73.       Top             =   1440
  74.       Width           =   1335
  75.    End
  76.    Begin Label Label3 
  77.       Alignment       =   1  'Right Justify
  78.       Caption         =   "Version:"
  79.       Height          =   255
  80.       Left            =   960
  81.       TabIndex        =   4
  82.       Top             =   1200
  83.       Width           =   1335
  84.    End
  85.    Begin Label Label2 
  86.       Alignment       =   1  'Right Justify
  87.       Caption         =   "Attached printers:"
  88.       Height          =   255
  89.       Left            =   720
  90.       TabIndex        =   3
  91.       Top             =   960
  92.       Width           =   1575
  93.    End
  94.    Begin Label Label1 
  95.       Alignment       =   1  'Right Justify
  96.       Caption         =   "Status:"
  97.       Height          =   255
  98.       Left            =   1200
  99.       TabIndex        =   2
  100.       Top             =   720
  101.       Width           =   1095
  102.    End
  103.    Begin Label Title 
  104.       Height          =   495
  105.       Left            =   480
  106.       TabIndex        =   1
  107.       Top             =   240
  108.       Width           =   5535
  109.    End
  110. End
  111.  
  112. Sub Form_Load ()
  113.     Dim info As PS_INFO
  114.  
  115.     Title.Caption = "Information on print server :  " + PrintServerName$ + " :"
  116.     ServerList.Clear
  117.     
  118.     ccode% = PSAttachToPrintServer(PrintServerName$, connID%)
  119.     If (ccode% <> SUCCESSFUL) Then
  120.         PSStatus.Caption = "Unable to attach to print server"
  121.     Else
  122.         ccode% = PSGetPrintServerInfo(connID%, info, Len(info))
  123.         If (ccode% <> SUCCESSFUL) Then
  124.             MsgBox "Unable to get print server information", MB_OK, "Error"
  125.         Else
  126.             Select Case Asc(info.status)
  127.                 Case RUNNING
  128.                     PSStatus.Caption = "Running"
  129.                 Case GOING_DOWN
  130.                     PSStatus.Caption = "Going down"
  131.                 Case DOWN
  132.                     PSStatus.Caption = "Down"
  133.                 Case INITIALIZING
  134.                     PSStatus.Caption = "Initializing"
  135.                 Case Else
  136.                     PSStatus.Caption = "Unknown"
  137.             End Select
  138.  
  139.             PSPrinters.Caption = Asc(info.numPrinters)
  140.             PSVersion.Caption = Format$(Asc(info.majorVersion)) + "." + Format$(Asc(info.minorVersion)) + Chr$(Asc(info.revision) + 97)
  141.             
  142.             Select Case Asc(info.serverType)
  143.                 Case 1
  144.                     PSType.Caption = "Dedicated DOS"
  145.                 Case 2
  146.                     PSType.Caption = "NLM"
  147.                 Case 3
  148.                     PSType.Caption = "File Server VAP"
  149.                 Case 4
  150.                     PSType.Caption = "Bridge VAP"
  151.                 Case Else
  152.                     PSType.Caption = "Unknown"
  153.             End Select
  154.  
  155.             sequence% = 0
  156.             Do
  157.                 serverName$ = String$(48, 0)
  158.                 ccode% = PSGetAttachedServers(connID%, sequence%, serverName$)
  159.                 ServerList.AddItem serverName$
  160.             Loop While (ccode% = SUCCESSFUL)
  161.         End If
  162.         
  163.         ccode% = PSDetachFromPrintServer(connID%)
  164.     End If
  165. End Sub
  166.  
  167. Sub OKButton_Click ()
  168.     Unload PSInfoForm
  169. End Sub
  170.  
  171. Sub PSInfoForm_Click ()
  172.     Unload PSInfoForm
  173. End Sub
  174.  
  175.